package com.hhl.test;

import com.alibaba.fastjson.JSONObject;
import com.hhl.menu.*;
import com.hhl.util.HttpRequestUtil;
import com.hhl.util.WXURLUtil;


/**
 * 大坪病案打印
 * 说明：<br>
 * <h1>创 建 人: hehailong   <br></h1>
 * 创建日期: 2017-11-13 下午4:43:51<br>
 * 需要的jar包:
 */
public class menutest6 {

	public static void main(String[] args) {

		ViewButton webSetApp1 = new ViewButton();
		webSetApp1.setName("行业资讯");
		webSetApp1.setType("view");
		webSetApp1.setUrl("https://mp.weixin.qq.com/s?__biz=Mzk0NDI0Mzg1OQ==&mid=2247483713&idx=1&sn=55f3e53a58d8690c4c23945c1cb7fa51&chksm=c326d4bdf4515dab22419fcaa430e782c584e9d798227c22af5caa1e98deb7677bb6e94782bc&token=1476664008&lang=zh_CN#rd");

		ViewButton webSetApp2 = new ViewButton();
		webSetApp2.setName("专病建设实践");
		webSetApp2.setType("view");
		webSetApp2.setUrl("https://mp.weixin.qq.com/s?__biz=Mzk0NDI0Mzg1OQ==&mid=2247483703&idx=1&sn=6c1762de78991f940435c41b63ef0242&chksm=c326d4cbf4515ddd9dcfce67e9b38dea0ea7ed31d10a7d1956f34aef14aff3cd6924dc3ee0ea&token=1952121883&lang=zh_CN#rd");

		ComlexButton menu2 = new ComlexButton();
		menu2.setName("行业交流");
		menu2.setSub_button(new BaseButton[]{webSetApp1,webSetApp2});


		ViewButton vb1_1 = new ViewButton();
		vb1_1.setName("功能介绍");
		vb1_1.setType("view");
		vb1_1.setUrl("https://mp.weixin.qq.com/s?__biz=Mzk0NDI0Mzg1OQ==&mid=2247483727&idx=1&sn=2e7c854865ad2ce12734fefda5dada24&chksm=c326d4b3f4515da59a1bf2ccb35987e449485f9b404611d755d78004e2d4f4c1aaad05a29a19&token=781629503&lang=zh_CN#rd");

		ViewButton vb1_2 = new ViewButton();
		vb1_2.setName("患者签到码");
		vb1_2.setType("view");
		vb1_2.setUrl("https://mp.weixin.qq.com/s?__biz=Mzk0NDI0Mzg1OQ==&mid=2247483724&idx=1&sn=89d2a21b4e3ca22d3de437e65218bd04&chksm=c326d4b0f4515da66d8ec666fdb51d505b173df3b3bb85e3f918580b983ac94bce90a3bc7e4a&token=1952121883&lang=zh_CN#rd");

		ComlexButton menu1 = new ComlexButton();
		menu1.setName("智能应用");
		menu1.setSub_button(new BaseButton[]{vb1_1,vb1_2});


		MiniButton aa1 = new MiniButton();
		aa1.setName("患者管理");
		aa1.setType("miniprogram");
		aa1.setUrl("http://mp.weixin.qq.com");
		aa1.setAppid("wxf6d0f6314d927fee");
		aa1.setPagepath("pages/loading/loading");

		Menu menu = new Menu();
		menu.setButton(new BaseButton[]{menu2,menu1,aa1});
		
		String btnJson = JSONObject.toJSONString(menu);

		System.out.println(btnJson);

		
		String token = "73_dl5jrTqCFyCIYyeg4gUvT-oer9BtjDHW84opC7GoLDCMop_d-hbXHrHux_fEOWcQ838cOZRDPLOm7o_6FZH7awsmzbWVcYacs7KrQ_GgmhWP59g7LdE0sEmwa3oXYJeACAKLW";
		System.out.println(JSONObject.toJSONString(menu));
		
		
		JSONObject bbb = HttpRequestUtil.httpRequest(WXURLUtil.MENU_URL.replace("ACCESS_TOKEN", token), "POST", JSONObject.toJSONString(menu));
		System.out.println(JSONObject.toJSONString(bbb));
		
	}
	
}
